<!-- 通用抽屉 -->
<template>
  <a-drawer
    v-model:visible="vdata.visible"
    title="流水记录"
    :closable="true"
    :body-style="{ paddingBottom: '80px' }"
    :drawer-style="{ backgroundColor: '#f0f2f5' }"
    width="85%"
    @close="vdata.visible = false"
  >
    <div>
      <HistoryPanel v-if="vdata.visible" ref="historyPanelRef" :showSearch="true" :showAllSearch="false" :defaultQueryCondition="vdata.defaultQueryCondition" />
    </div>
  </a-drawer>
</template>

<script lang="ts" setup >
import { ref, reactive, defineExpose } from 'vue'
import HistoryPanel from './HistoryPanel.vue'

const historyPanelRef = ref()

const vdata : any = reactive({
    visible: false, // 一级抽屉开关
    defaultQueryCondition: {}, // 查询集合的条件
})

// 弹层打开事件
function show (queryObject, isShow) {
  vdata.defaultQueryCondition = queryObject
  vdata.showSearch = isShow
  vdata.visible = true
}

defineExpose({ show })
</script>
